import 'package:fish_redux/fish_redux.dart';
import '../../../../PublicSource/widgets/image_picker_component/state.dart';
import 'package:flutter/material.dart';
import '../../BindAccountView/AccountInfoView/state.dart';

class SendProblemViewState implements Cloneable<SendProblemViewState> {
  List images = [];
  String time;
  TextEditingController contactController = TextEditingController();
  TextEditingController phoneController = TextEditingController();
  TextEditingController addressController = TextEditingController();
  TextEditingController contentController = TextEditingController();
  String accountNo;
  String accountName;
  GasAccountInfoModel model;

  @override
  SendProblemViewState clone() {
    return SendProblemViewState()
      ..images = images
      ..time = time
      ..contactController = contactController
      ..phoneController = phoneController
      ..addressController = addressController
      ..contentController = contentController
      ..accountNo = accountNo
      ..accountName = accountName
      ..model = model;
  }
}

SendProblemViewState initState(Map<String, dynamic> args) {
  return SendProblemViewState()
    ..accountName = args['accountName'] ?? null
    ..accountNo = args['accountNo'] ?? null;
}

class DraggableImagePickerComponentConn
    extends ConnOp<SendProblemViewState, DraggableImagePickerState> {
  @override
  DraggableImagePickerState get(SendProblemViewState state) {
    final DraggableImagePickerState sub = DraggableImagePickerState()
      ..items = state.images;
    return sub;
  }

  @override
  void set(SendProblemViewState state, DraggableImagePickerState substate) {
    state.images = substate.items;
  }
}
